import {http} from '@/utils/http'

interface ResponseType extends Promise<any> {
    data?: object;
    code?: number;
    message?: string;
}

export const getCodeImg = (): ResponseType => http.request(
    'get',
    '/auth/code'
)

export const login = (username: string, password: string, code: string, uuid: string): ResponseType => http.request(
    'post',
    '/auth/login',
    {
        data: {
            username, password, code, uuid
        }
    }
)

export const getInfo = (): ResponseType => http.request(
    'get',
    '/auth/info'
)

export const logout = (): ResponseType => http.request(
    'delete',
    '/auth/logout'
)

export const updatePassword = (params: Object): ResponseType => http.request(
    'put',
    '/sys/user/updatePassword',
    {
        params
    }
)